$(function() {
	$("#Button2").bind("click", function() {
				document.location = context + "/site/companySupplier/7.jsp";
			});

	var id = getParameter("7-1.js", "id");
	var indentID = getParameter("7-1.js", "indentID");

	var jsonparams = {
		id : id,
		primaryTable : "financialProduct"
	}

	new $.grooveViewPreII(jsonparams, "viewcreditproduct", {
		formID : "formView",
		beforecall : function() {

		},
		aftercall : function() {

		},
		rendercall : function(selfFunc, validator, validators, data, dataBean) {
			new $.grooveView("add-loan-apply", {
				submitMessage : "确定提交融资产品贷款申请",
				OKMessage : "已成功提交贷款申请",
				submitButtonID : "Button1",
				formID : "formID",
				params : {
					indentID : indentID
				},
				rendercall : function() {
					// 融资产品预览信息初始化后，将融资产品部分必要信息赋值到贷款申请相应表单域
					// 融资产品内容参见view定义ID=viewcreditproduct
					// 部分js变量在7-1.jsp中初始化定义
					$("#LA_INDUSTRY").val(industry);
					$("#LA_INDUSTRYID").val(industryid);
					$("#LA_LOANPRODUCTNAME").val(dataBean.FP_NAME);
					$("#LA_LOANPRODUCTID").val(id);
					$("#LA_FCID").val($("#FP_COMPANYID").val());
					$("#LA_FCNAME").val($("#FP_COMPANY").val());
					$("#LA_CREDITID").val($("#userid").val());
					$("#LA_CREDITNAME").val($("#username").val());
				},
				aftercall : function() {
					document.location = context + "/site/companySupplier/7.jsp";
				}
			});

			new $.grooveViewPreII({
						id : indentID,
						primaryTable : "fcindent",
						foreignTables : [{
									foreignTable : "fcindentlist",
									listid : "fcorderlist"
								}]
					}, "viewfcorder", {
						formID : "formIndentView",
						beforecall : function() {

						},
						aftercall : function() {

						},
						rendercall : function(selfFunc, validator, validators,
								data) {

						}
					});
		}
	});

	$("#pageloading").hide();
});